package com.neusoft.weekreport.component.simpleUploader.service;

import com.neusoft.weekreport.component.simpleUploader.entity.FileChunkDTO;
import com.neusoft.weekreport.component.simpleUploader.entity.FileChunkResultDTO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author liu.jiaming
 * @Create 2022/11/1 9:48
 */
public interface UploadService {

    /**
     * 检查文件是否存在，如果存在则跳过该文件的上传，如果不存在，返回需要上传的分片集合
     * @param chunkDTO
     * @return
     */
    FileChunkResultDTO checkChunkExist(FileChunkDTO chunkDTO, HttpServletResponse response);


    /**
     * 上传文件分片
     * @param chunkDTO
     */
    void uploadChunk(FileChunkDTO chunkDTO) throws IOException;


    /**
     * 合并文件分片
     * @param identifier
     * @param fileName
     * @param totalChunks
     * @return
     * @throws IOException
     */
    boolean mergeChunk(String identifier,String fileName,Integer totalChunks,String path)throws IOException;

}
